<?php


namespace App\Bx;


use App\Job\IJob;
use App\Utils\Logger;

class BxSaveJob extends IJob
{

    protected $data;

    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function handle()
    {
//        Logger::getLogger("bx_save")->info("datas",['data'=> $this->data]);
        try{
            $response = (new BxElastic())->pushToIndex($this->data);
            Logger::getLogger('bx_elas')->info('test',['response'=> $response]);
        }catch (\Exception $e) {
            Logger::getLogger('bx_save')->error($e->getMessage());
//            sleep(1);
//            dispatch($this)->onQueue('BX_ANI');
        }


    }
}